<template>
	<view>
		<u-sticky :offset-top="h">
			<view class="p1 mianGg">
				<u-search shape="round" :showAction='false' placeholder="请输入关键词搜索相关内容" @search='getList'
					v-model="queryParams.expectationPostName"></u-search>
			</view>
		</u-sticky>
		<DaDropdownVue2 :fixedTopValue='h + 44' :dropdownMenu="dropdownMenuList" themeColor="#007aff"
			textColor="#333333" :duration="300" fixedTop @confirm="handleConfirm" @close="handleClose"
			@open="handleOpen">
		</DaDropdownVue2>
		<scroll-view scroll-y @scrolltolower="loadMore" :style="{'height': `calc(100vh - ${upx2px}px)`}"
			:scroll-with-animation="true">
			<!-- 内容区域 -->
			<view v-for="item in talentListData">
				<rencai :list="item"></rencai>
			</view>
			<Loading :status='status'></Loading>

		</scroll-view>


	</view>
</template>

<script>
	import DaDropdownVue2 from '@/components/da-dropdown-vue2/index.vue'
	import {
		talentList
	} from '@/api/rencai/rencai.js'
	import rencai from '@/components/common/rencai/rencai.vue'
	import Loading from '@/components/loading/loading.vue'
	import {
		getNavigationBarHeight,
		getTitleBarHeight
	} from '@/utils/system.js';
	export default {
		name: "position",
		components: {
			DaDropdownVue2,

			rencai,
			Loading
		},
		data() {
			return {
				status: 'loadmore',
				upx2px: uni.upx2px(400),


				keyword: '',
				talentListData: [],
				queryParams:{
					pageNum:1,
					pageSize:10,
					expectationPostName:''
				},
				dropdownMenuList: [{
						title: '期望岗位',
						type: 'cell',
						prop: 'god1',
						showAll: true,
						showIcon: true,
						// value: '2', // 默认内容2
						options: [{
								label: '日结',
								value: 0
							},
							{
								label: '月结',
								value: 1
							},
						],
					},
					{
						title: '期望薪资',
						type: 'cell',
						prop: 'god2',
						showAll: true,
						showIcon: true,
						// value: '2', // 默认内容2
						options: [{
								label: '日结',
								value: 0
							},
							{
								label: '月结',
								value: 1
							},
						],
					},
					{
						title: '年龄',
						type: 'cell',
						prop: 'god3',
						showAll: true,
						showIcon: true,
						// value: '2', // 默认内容2
						options: [{
								label: '日结',
								value: 0
							},
							{
								label: '月结',
								value: 1
							},
						],
					},
					{
						title: '性别',
						type: 'cell',
						prop: 'god1',
						showAll: true,
						showIcon: true,
						// value: '2', // 默认内容2
						options: [{
								label: '日结',
								value: 0
							},
							{
								label: '月结',
								value: 1
							},
						],
					}
				]
			};
		},
		methods: {
			async getTalentList(data) {
				let res = await talentList(data)
				console.log(res,"人才")
				if (res.code == 200) {
					// this.gangWeiList = res.rows
					if(this.talentListData.length < res.total){
						this.talentListData=[...this.talentListData,...res.rows]
					}else{
						this.status = "nomore"
					}
				}

			},
			async searchGetTalentList(data) {
				let res = await talentList(data)
				console.log(res,"人才")
				if (res.code == 200) {
					// this.gangWeiList = res.rows
					
						this.talentListData=res.rows
					
				}
			
			},
			loadMore() {
				if(this.status == "nomore")return
				console.log('底部触发')
				this.status = 'loading'
				this.queryParams += 1
				this.getTalentList(this.queryParams)
			},
			handleConfirm(v) {
				console.log('handleConfirm ==>', v)
			},
			handleClose(v) {
				console.log('handleClose ==>', v)
			},
			handleOpen(v) {
				console.log('handleOpen ==>', v)
			},
			// 查詢崗位
			getList() {
				// console.log(this)
				this.searchGetTalentList(this.queryParams)
			}

		},

		computed: {
			h() {
				console.log(getNavigationBarHeight(),"=====================dsadasdasd")
				return getNavigationBarHeight() + getTitleBarHeight()
			}
		},
		mounted() {
			// console.log(2222)
			this.getTalentList(this.queryParams)
		}

	}
</script>

<style lang="scss">
	.fixed {
		height: 40rpx;
		position: fixed;
		left: 0;
		right: 0;
		// background-color: indianred;
	}
</style>